﻿using UnityEngine;
using System.Collections;

public class CollisionDetecter : MonoBehaviour {
    private Element test;

    public void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
            case "Element":
                ScreenGeneral.Neko.Action = EnumTypes.CharactherAction.PickUp;
                test = other.GetComponent<ElementModel>().GetElement();
                ScreenGeneral.CollisionElement = test;//other.gameObject.GetComponentInChildren(Element);
                break;
            case "NPC":
                ScreenGeneral.Neko.Action = EnumTypes.CharactherAction.Talk;
                Debug.Log(other.name);
                break;
        }
    }

    public void OnTriggerStay(Collider other)
    {
        if (ScreenGeneral.CollisionElement == null)
        {
            if (other.gameObject.CompareTag("Element"))
                Destroy(other.gameObject);
        }
        other.transform.position = other.transform.position;
    }

    public void OnTriggerExit(Collider other)
    {
        ScreenGeneral.CollisionElement = null;
        ScreenGeneral.Neko.Action = EnumTypes.CharactherAction.Walk;
    }
}
